<template>
	<view>
		<view class="form">
          <uni-card :isFull="true">
            <view class="uni-body">
              <uni-forms>
                <uni-forms-item label="文章标题" required name="title">
                  <uni-easyinput
                    v-model="valiFormData.title"
                    placeholder="请输入文章标题"
                  />
                </uni-forms-item>
    
                <uni-forms-item label="文章内容" name="content">
                  <uni-easyinput
                    type="textarea"
                    v-model="valiFormData.content"
                    placeholder="请输入文章内容"
                  />
                </uni-forms-item>
              </uni-forms>
              <button type="primary" @click="submit()">发布文章</button>
            </view>
          </uni-card></view>
		  </view>
</template>

<script setup>
import {ref} from 'vue'

const db = uniCloud.database()

const valiFormData = ref({ 
	title: '',
	content: ''
})

const submit = () => { 
	return uni.showToast({
		title: '待开发',
		icon: 'none',
		mask: true
	})
	console.log(valiFormData.value)
	db.collection('opendb-news-articles').add(valiFormData.value)
}

</script>

<style>
</style>
